package com.example.business_oa.controller;


import com.example.business_oa.service.QiDongLiZhiService;
import com.example.business_oa.service.SelectLeaderService;
import com.example.business_oa.service.ZfDimissionService;
import com.example.comment_oa.pojos.Dimission;
import com.example.comment_oa.pojos.Jobrequirements;
import com.example.comment_oa.pojos.SysEmployee;
import com.example.comment_oa.response.AjaxResponse;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;

@RestController
@CrossOrigin
@RequestMapping("/businessOa")
public class QiDongLiZhiController {

    @Resource
    QiDongLiZhiService qiDongLiZhiService;
    @Resource
    ZfDimissionService dimissionService;
    @Resource
    SelectLeaderService selectLeaderService;

    @PostMapping("/qidongLiZhiShenQing")
    public AjaxResponse qidongLiZhiShenQing(@RequestBody Dimission dimission){
        int shenqinglizhi = dimissionService.shenqinglizhi(dimission);
        String gonghao = dimission.getDimGonghao();
        String bianhao = dimission.getDimBianhao();
        //这个是关于流程的
        HashMap<String, Object> variables = new HashMap<>();
        SysEmployee sysEmployee = selectLeaderService.selectGongHao(gonghao);

        String assignee1 = sysEmployee.getEmpCard();
        //要一个工号 ：是发起人的
        // 一个编号 是 ：主键
//        System.err.println("assignee1"+assignee1);
        qiDongLiZhiService.qidongLiZhiShenQing(gonghao,variables,assignee1,bianhao);
        return AjaxResponse.success(shenqinglizhi);
    }
}
